#pragma once
#include "loadUtils.h"

struct ProductVars{
	int id;
	char desc[50];
	int catid;
	int agentid;
	int stock;
	int deliverytime;
	int price;
};

struct ProductVars *productdata;

int productcount;
/**
 * @brief Load product file into memory
 *
 * @param filename
 *
 * @return return code
 */
int loadProducts(char const *filename);
/**
 * @brief save productdata to file
 *
 * @param filename
 *
 * @return return code
 */
int writeProducts(char const *filename);
/**
 * @brief add a product to the vector, reallocates if needed
 *
 * @param n
 */
void addProduct(struct ProductVars n);
/**
 * @brief removes a product by index, find it yourself first ;)
 *
 * @param index
 */
void rmProduct(int index);


/**
 * @brief displays the admin menu of products
 *
 */
void AdminProductsMenu();

/**
 * @brief displays the prov menu of products
 *
 */
void ProvProductsMenu();

/**
 * @brief displays the client menu of products
 *
 */
void ClientProductsMenu();

/**
 * @brief shows all products without using categories
 *
 */
void listProducts();
/**
 * @brief shows all products using categories
 *
 */
void listProductsCategory();

/**
 * @brief shows all the information of a product
 * 
 * @param index
 *
 */
void infoProduct(int index);

/**
 * @brief adds a non-existent product
 *
 */
void newProduct();

/**
 * @brief deletes an existent product
 *
 */
void removeProduct();

/**
 * @brief search a product using the name
 * 
 * @return the index if the product exist or 0 if it isnt
 *
 */
int searchProduct();

